package com.theshy.test.service;

import com.theshy.test.dao.Student;
import com.theshy.test.domain.BassStudentDao;
import com.theshy.test.domain.OtherStudentDao;
import com.theshy.test.domain.StudentDao;
import com.theshy.test.factory.StudentDaoFactory;

public class StudentService {

//    OtherStudentDao studentDao = new OtherStudentDao();
//    StudentDao studentDao = new StudentDao();
       BassStudentDao studentDao = StudentDaoFactory.getStudentDao();

    public boolean Addstudent(Student s) {

        return studentDao.Addstudent(s);
    }

    public boolean isExist(int id) {


        return studentDao.haveID(id);
    }

    public Student[] checkStudent() {

        Student[] s = studentDao.checkStudent();

        for (int i = 0; i < s.length; i++) {
            if(s[i]!=null){
                return s;
            }
        }
        return null;
    }

    public void Delete(int id) {

             studentDao.DeleteStudent(id);

    }

    public boolean change(Student student) {

           return studentDao.ChangeStudent(student);
    }
}
